import React, {Component} from 'react';
import {Redirect, Route, Switch} from "react-router-dom";
import News from "./home/News";
import Images from "./home/Images";
import MyNavLink from "../../components/MyNavLink";
import NavBar from "../../components/NavBar";

class Home extends Component {
    render() {
        return (
            <div className={'layout-content-warp'}>
                <NavBar/>
                <h2>首页内容</h2>
                <ul className={'menu'}>
                    <li><MyNavLink to='/home/news'>新闻</MyNavLink></li>
                    <li><MyNavLink to='/home/images'>图片</MyNavLink></li>
                </ul>
                <div>
                    {/* 注册路由 */}
                    <Switch>
                        <Route path='/home/news' component={News}/>
                        <Route path='/home/images' component={Images}/>
                        <Redirect to='/home/news'/>
                    </Switch>
                </div>
            </div>
        );
    }
}

export default Home;
